//
// Created by liushuai on 18-10-29.
//

#include "Coordinate.h"
Coordinate::Coordinate(int x, int y) {
    X = x;
    Y = y;
}
int Coordinate::getX() {
    return X;
}
int Coordinate::getY() {
    return Y;
}
//Coordinate& Coordinate::operator-() {
//    X = -X;
//    Y = -Y;
//    return *this;
//}
Coordinate &operator-(Coordinate& c) {
    c.X = -c.X;
    c.Y = -c.Y;
    return c;
}
Coordinate &Coordinate::operator++() {
    this->X = ++(this->X);
    this->Y = ++(this->Y);
    return *this;
}
Coordinate Coordinate::operator++(int) {
    Coordinate old(*this);
    this->X = (this->X)++;
    this->Y = (this->Y)++;
    return old;
}
Coordinate operator+(const Coordinate& c1, const Coordinate& c2)
{
    Coordinate result;
    result.X = c1.X+c2.X;
    result.Y = c1.Y+c2.Y;
    return result;
}
int Coordinate::operator[](int index) {
    if(index == 0)
        return this->X;
    else
        return this->Y;
}
ostream& operator<<(ostream& out,const Coordinate& coor){
    std::cout<<coor.X<<":"<<coor.Y<<"\n";
}